#include "common.h"

int main() {
    key_t key = getKey();
    printf("key: 0x%x\n", key);
    int shm_id = getShm(key);
    printf("shm_id: %d\n", shm_id);

    char* start = (char*)attachShm(shm_id);
    printf("attach success, address start: %p\n", start);

    const char* message = "Hello server, i am your client, i am calling now!";
    pid_t pid = getpid();
    int cnt = 1;
    while (true) {
        snprintf(start, MAX_SIZE, "%s[pid: %d][message codeL: %d]", message, pid, cnt++);
        sleep(3);
    }
    detachShm(start);
    return 0;
}